import type { Context } from 'koa'
import { Get } from '../../router'

// import { database } from '../../database'

// import { User } from '../db'
import { result } from '../index'

export default class PostInfo {
  @Get('/post')
  static async getPostInfo(ctx: Context) {
    const { id } = ctx.params
    const user = ctx.state.user
    console.log('user  ', user)
    if (!id || user.id !== id) {
      return ctx.throw(400, '非法用户')
    }
    try {
      ctx.body = result({})
    } catch (error) {
      return ctx.throw(500, error)
    }
  }
}
